#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

typedef int64_t num_t;
#define NUM_MAX INT64_MAX
#define NUM_PPH PRId64
#define NUM_SPH SCNd64

num_t gcd_loop(num_t a, num_t b) {
    while (b != 0) {
        num_t tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

num_t lcm_three(num_t a, num_t b, num_t c) {
    num_t lcm_ab = a * b / gcd_loop(a, b);
    return lcm_ab * c / gcd_loop(lcm_ab, c);
}

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int n;
        scanf("%d", &n);
        num_t* nums = (num_t*) calloc(n, sizeof(num_t));
        for(int k = 0; k < n; k++) {
            scanf("%" NUM_SPH, nums + k);
        }
        
        // 就硬穷举
        num_t min = NUM_MAX;
        for (int a = 0; a < n; a++) {
            for (int b = a + 1; b < n; b++) {
                for (int c = b + 1; c < n; c++) {
                    num_t lcm = lcm_three(nums[a], nums[b], nums[c]);
                    if (lcm < min) {
                        min = lcm;
                    }
                }
            }
        }
        printf("%" NUM_PPH "\n", min);
        free(nums);
    }
    return 0;
}
